From 2aaf82cb249912d5813be4f189d64ff1488d3c4e Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Wed, 5 Oct 2011 08:11:14 -0500 Subject: [PATCH] Replacement for eel_pop_up_context_menu() Signed-off-by: Federico Mena Quintero --- gtk/gtkplacessidebar.c | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c index 96e44dcd84..78d58f64c6 100644 --- a/gtk/gtkplacessidebar.c +++ b/gtk/gtkplacessidebar.c @@ -2726,13 +2726,35 @@ bookmarks_update_popup_menu (GtkPlacesSidebar *sidebar) static void bookmarks_popup_menu (GtkPlacesSidebar *sidebar, - GdkEventButton *event) + GdkEventButton *event) { + int button; + bookmarks_update_popup_menu (sidebar); - eel_pop_up_context_menu (GTK_MENU(sidebar->popup_menu), - EEL_DEFAULT_POPUP_MENU_DISPLACEMENT, - EEL_DEFAULT_POPUP_MENU_DISPLACEMENT, - event); + + /* The event button needs to be 0 if we're popping up this menu from + * a button release, else a 2nd click outside the menu with any button + * other than the one that invoked the menu will be ignored (instead + * of dismissing the menu). This is a subtle fragility of the GTK menu code. + */ + if (event) { + if (event->type == GDK_BUTTON_RELEASE) + button = 0; + else + button = event->button; + } else { + button = 0; + } + + gtk_menu_popup (GTK_MENU (sidebar->popup_menu), /* menu */ + NULL, /* parent_menu_shell */ + NULL, /* parent_menu_item */ + NULL, /* popup_position_func */ + NULL, /* popup_position_user_data */ + button, /* button */ + event ? event->time : gtk_get_currrent_event_time ()); /* activate_time */ + + gtk_object_sink (GTK_OBJECT (menu)); } /* Callback used for the GtkWidget::popup-menu signal of the shortcuts list */ -- 2.30.2